#ifndef QRCODECREATOR_H
#define QRCODECREATOR_H

#include <string>
#include <vector>

#include "common/symbol.h"
#include "pictureinfo.h"

namespace qrcode{

class QRCodeCreator
{
private:
    std::string _msg;
    char _errorLevel;
    std::string _modeIndicator;

    int _version;
    int _characterCountIndicator;
    int _ECCodewordsPerBlock;
    std::vector<char> _remainderBits;

    PictureInfo pic;

    int SelevtSmallestVersion(std::string &mode, char &level, int capacity);

    std::pair<group, group> BreakIntoBlock(std::vector<std::vector<char> > &codeWords);

    std::pair<group, group> ECCEncoding(std::pair<group, group> &p);

    std::vector<std::vector<char>> InterleaveBlocks(std::pair<group, group> &codeGroup,
                                                    std::pair<group, group> &eccGroup);

    std::vector<char> ToBitStream(std::vector<std::vector<char> > &msg);
    void PrintBits(std::vector<char> vec);
    
public:
    QRCodeCreator(std::string &msg, char &errorLevel,
                  std::string &modeIndicator);
    ~QRCodeCreator();
    bool Create();
    void setPic(const PictureInfo &value);
};

}

#endif // QRCODECREATOR_H
